a = {
    "firstname": "Tian",
    "lastname": "Song",
    "address": {
        "streetAddr": "中关村南大街5号",
        "city": "北京市",
        "zipcode": "100081"
    },
    "professional": ["Computer Networking", "Security"]
}
# 数据有序用列表[]
# 数据无序用集合{}
# for循环遍历数据

# 从空格分隔的文件中读入数据
f = open("file.txt")
txt = open("file.txt", encoding='UTF-8').read()
ls = txt.split()
print(ls)
f.close()

# 从特殊符号（$）分隔的文件中读入数据
f2 = open("file2.txt")
txt2 = open("file2.txt", encoding='UTF-8').read()
ls2 = txt2.split("$")
print(ls2)
f.close()

# 采用空格分隔方式将数据写入文件
ls = ['中国', '美国', '日本']
f3 = open("file_a.txt", "w")
f3.write(' '.join(ls))
f3.close()

# 采用特殊分隔方式将数据写入文件
ls = ['中国', '美国', '日本']
f4 = open("file_b.txt", "w")
f4.write('$'.join(ls))
f4.close()
